package com.wallet.mappers;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wallet.entity.WalletEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;

/**
 * 用户钱包Mapper
 * @author zhangguangyuang
 */
@Mapper
public interface WalletMapper extends BaseMapper<WalletEntity> {

    // 1.查询用户钱包余额
    BigDecimal getMoneyInWallet(@Param("userId") Integer userId);

    // 2. 用户消费 100 元
    // 用钱包消费100元
    Integer decreaseMoneyInWallet(@Param("userId") Integer userId, @Param("money") BigDecimal decreaseMoney);

    // 获取 money和id
    WalletEntity getMoneyAndIdByUserId(@Param("userId")Integer userId);

    Integer refundToWallet(WalletEntity wallet);
}
